#include "graph.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN=200+5;
#define Pair pair<int,int>
int deg[MAXN];
int is_fa[MAXN][MAXN];//返祖边
int col[3],tot;
int mx[MAXN];
Pair dfs_first(int Dep,int bian){
	int point=++tot;
	if(bian!=-1)Move(bian,2);
	int lst=LastRoad();
	if(Color()!=1){
		int del;
		if(bian!=-1){
			Move(lst,del=Color());
		}
		tot--;return Pair(del,point);
	}
	deg[point]=NumberOfRoads();
	for(int i=1;i<=deg[point];i++)if(i!=lst){
		Pair now=dfs_first(Dep+1,i);
		if(now.first==2){
			int u=now.second;
			is_fa[point][i]=0;
		}else if(now.first==3){
			int u=now.second;
			is_fa[point][i]=-2;
		}else{
			int u=now.second;
		}
	}
	if(bian!=-1)mx[point]=1,Move(lst,3);
	return Pair(-1,point);
}
bool fir;
int fc[MAXN];
vector<int>G[MAXN];
int stk[MAXN],tp=-1;
inline void add(int u,int v){G[u].push_back(v);}
int dfs(int Dep,int S){
	int point=++tot;
	int lst=LastRoad();
	if(fir)lst=-1,fir=0;
	if(S==4){
		stk[++tp]=point;
	}
	for(int i=1;i<=deg[point];i++)if(i!=lst&&is_fa[point][i]!=-2){
		 Move(i,col[(Dep/fc[S])%3]);
		int lastroad=LastRoad();
		if(is_fa[point][i]==-1){
			int v=dfs(Dep+1,S);
			Move(lastroad,col[((Dep+1)/fc[S])%3]);
			if(S==4){
				add(point,v),add(v,point);
			}
		}else{
			int now=Color();
			if(now==col[1])is_fa[point][i]+=fc[S];
			else if(now==col[2])is_fa[point][i]+=2*fc[S];
			Move(lastroad,Color());
			if(S==4){
				int delta=is_fa[point][i];
				int u=stk[delta];
				add(point,u),add(u,point);
			}
		}
	}
	if(S==4)tp--;
	return point;
}
int dis[MAXN][MAXN];
int ans[MAXN];
void Inspect(int R) {
	fc[0]=1;
	for(int i=1;i<=6;i++)fc[i]=fc[i-1]*3;
	memset(is_fa,-1,sizeof is_fa);
	col[0]=2,col[1]=3,col[2]=1;
	fir=1;tot=0;dfs_first(0,-1);
	for(int i=0;i<=4;i++){
		fir=1;tot=0;dfs(0,i);
	}
	int n=tot;
	memset(dis,0x3f,sizeof dis);
	for(int i=1;i<=n;i++)dis[i][i]=0;
	for(int u=1;u<=n;u++)for(int v:G[u])dis[u][v]=1;
	for(int k=1;k<=n;k++)for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
		dis[i][j]=min(dis[i][j],dis[i][k]+dis[k][j]);
	}
	for(int i=1;i<=n;i++)for(int j=1;j<=n;j++){
		ans[dis[i][j]]++;
	}
	for(int i=1;i<=R;i++)Answer(i,ans[i]/2);
}